package com.lovo.frame;

import com.lovo.util.Util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class FindPanel extends JPanel implements ActionListener {
//    private Icon bgOff = Util.getIcon("/images/buttonOff.jpg");
    private ATM frame;
    private JButton offButton = new JButton("退出");
    private JLabel blanceInfoLabel = new JLabel("您的余额为：");
    private JLabel blanceLabel = new JLabel();


    public FindPanel(ATM frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);
        blanceInfoLabel.setBounds(300,200,200,50);
        blanceInfoLabel.setFont(new Font("宋体",Font.BOLD,25));
        this.add(blanceInfoLabel);

        blanceLabel.setBounds(500,200,200,50);
        blanceLabel.setFont(new Font("黑体",Font.BOLD,50));
        blanceLabel.setForeground(Color.RED);
        this.add(blanceLabel);
        offButton.setBounds(320,300,140,50);
        offButton.addActionListener(this);
        this.add(offButton);
    }
    public void setMoeny(double moeny){
        blanceLabel.setText(moeny + "");
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == offButton) {
            frame.switchPanel("menu");
        }
    }
}
